<style lang="less" scoped>
@import url('./style.less');
.txt {
  color: #3399fe;
}
.code {
  color: #666;
  font-size: 12px;
}
</style>
<template>
  <div class="box">
    <div class="box-title" @click="show=!show">
      <div class="box-title__label">对外投资信息</div>
      <div class="box-title__right">
        <span class="num">{{len||'无'}}</span>
        <i v-if="len>0" :class="cls"></i>
      </div>
    </div>
    <div class="box-content" v-show="show">
      <div class="panel" v-for="(item, index) in dt" :key="index">
        <div class="panel-title" @click="farenClick">
          <div class="panel-title__label">
            <div class="txt" @click="companyClick(item.CompanyId)">{{item.Name||'-'}}</div>
            <div class="code">{{item.RegNo||'-'}}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ['dt'],
  data() {
    return {
      show: false
    };
  },
  onUnload() {
    this.show = false;
  },
  computed: {
    cls() {
      const arrow = this.show ? 'icon-shangjiantou' : 'icon-tubiaozhizuo-';
      return `iconfont ${arrow}`;
    },
    len() {
      return this.dt.length;
    }
  },
  methods: {
    companyClick(id) {
      this.$router.push({
        path: '/pages/company/main',
        query: {
          unique: id
        }
      });
    }
  }
};
</script>
